<?php
/**
 * 同步操作
 * @author ice<iceinto@mallog.com.cn>
 */
class SynAction extends CommonAction
{
	public function index(){
	}

	/**
	 * 根据现有品牌生成文件夹
	 */
	public function brandmkdir(){
		//先更新SVN
		//根据目录获取
		$homeDir = 'E:/SVN/material/';
		$MallModel = D('Mall');
		$field='b_id as id,b_name as name,b_e_name as ename,initials';
		$brands = $MallModel->query('m_brand', $field, null, 'initials ASC');
		$map = array();
		foreach($brands as $key=>$brand){
			$dirName = strtoupper($brand['initials'].'-'.$brand['name']);
			$dirName = auto_charset($dirName, 'UTF-8', 'GBK');
			$brandHomeDir = $homeDir.$dirName;
			mk_dir($brandHomeDir);//创建目录
			//统计柜台
			$map['b_b_id'] = $brand['id'];
			$MallModel->_connect->table('m_floor_brand'); //设置操作的数据表
			$bCount = $MallModel->_connect->where($map)->count(); //查询
			$brands[$key]['count'] = $bCount;
		}
		$this->assign('brands', $brands);
		$this->display();
	}
}
?>